﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QiHe
{
    public partial class Depts_Edit : Form
    {
        DataSet DeptList;
        public Depts_Edit()
        {
            InitializeComponent();
        }

        private void Depts_Edit_Load(object sender, EventArgs e)
        {
            MedEQ.Service1 sop = new MedEQ.Service1();
            DeptList = sop.HSP_Department_List(DataTemp.HSPID);
            listBox1.DataSource = DeptList.Tables[0];
            listBox1.DisplayMember = "Name";
            listBox1.ValueMember = "ID";
        }

        private void button5_Click(object sender, EventArgs e)
        {
            MedEQ.Service1 sop = new MedEQ.Service1();
            string result = sop.Serv_Add_Dept(textBox8.Text.ToString().Trim(), DataTemp.HSPID);
            if (result == "1")
            {
                MessageBox.Show("添加成功");

                MedEQ.Service1 sop3 = new MedEQ.Service1();
                DeptList = sop3.HSP_Department_List(DataTemp.HSPID);

                listBox1.DataSource = DeptList.Tables[0];
                listBox1.DisplayMember = "Name";
                listBox1.ValueMember = "ID";
                textBox8.Text = "";

            }
        }
    }
}